import { getRequest, postRequest } from '/src/lib/axios';
import { localRead } from '/@/utils/local-util';
import LocalStorageKeyConst from '/@/constants/local-storage-key-const.js';
const token = localRead(LocalStorageKeyConst.live_TOKEN);
const baseUrl = "/easyLiveApi"

export const api = {
  getToken: () => {
    return postRequest({
      url: baseUrl + '/v1/login',
      data: {
        captcha: "",
        captcha_id: 0,
        password: "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918",
        username: "admin"
      }
    });
  },
  startLive: (id) => {
    const channels = {
      1421745317658624: 2,
      1421745383309312: 3,
      1422677198258176: 4,
      1422677225570304: 5,
    }
    return getRequest({
      url: baseUrl + '/v1/live/play/start/' + channels[id],
      header: {
        "authorization": token
      }
    });
  },
};